/**
 * 使用flowRight 写一个 sanitizeNames() 函数，返回一个下划线连接的小写字符串，
 * 把数组中的 name 转换为这种形式：例如：sanitizeNames(['Hello World']) -> ['hello_world']
 */

const { replace, map, prop, toLower, flowRight } = require('lodash/fp')
const { cars } = require('./data')

let _underscore = replace(/\W+/g, '_')


let sanitizeNames = map(flowRight(_underscore, toLower, prop('name')))
console.log(sanitizeNames(cars))
